import { NextRequest, NextResponse } from 'next/server'
import { verifyAuth } from '@/lib/auth-middleware'

export async function GET(request: NextRequest) {
  try {
    const authResult = await verifyAuth()
    
    if (!authResult.success) {
      return NextResponse.json({
        success: false,
        error: authResult.error
      }, { status: 401 })
    }

    return NextResponse.json({
      success: true,
      user: authResult.user
    })
  } catch (error) {
    return NextResponse.json({
      success: false,
      error: 'Authentication verification failed'
    }, { status: 401 })
  }
}